
set logscale xy

set datafile separator ","

value(count,sum,sum2)=sum/count
stdev(count,sum,sum2)=sqrt((sum2/count-(sum/count)**2)/count)

FIT_LIMIT=1e-31

c=1000
a=0.50
f(x)=c*x**(2*a)
fit f(x) 'hprim.csv' using 1:(value($3,$4,$5)):(stdev($3,$4,$5)) via a,c
#fit f(x) 'hprim.csv' using (($1>=1024 && $1 <= 131072) ? $1 : 1.0/0):(value($3,$4,$5)):(stdev($3,$4,$5)) via a,c

plot 'hprim.csv' using 1:(value($3,$4,$5)):(stdev($3,$4,$5)) with errorlines pt 5, f(x) with lines

pause -1

